#include "Utilities.h"
#include <GL/glut.h>
#include <cmath>

using namespace std;

int clamp(float x)
{ 
	return ((x)>=0.0?((int)(x)):(-((int)(1-(x))))); 
}

void drawBitmapText(string const &str, double x, double y, int size)
{    
    glColor3f(0.0f, 0.0f, 0.0f);
    glRasterPos2f(x, y);
    void *font = GLUT_BITMAP_HELVETICA_10;
    
    switch (size)
    {
        case 12:
            font = GLUT_BITMAP_HELVETICA_12;
            break;
        case 18:
            font = GLUT_BITMAP_HELVETICA_18;
            break;
    }
    
    for (auto itr = str.begin(); itr != str.end(); ++itr)
        glutBitmapCharacter(font, *itr);
}

float rad2deg(float rad) {
    return rad * -(180.0 / M_PI);
}